﻿using System;
using System.Web.Http;
using System.Web.Http.Description;
using Learun.Application.Organization;
using Learun.Util;

namespace Learun.Application.Web.AppApi
{
    /// <summary>
    /// 用户接口
    /// </summary>
    [RoutePrefix("api/UserApi")]
    [HandlerApiLogin(FilterMode.Enforce)]
    [TokenAuthorize]
    public class UserApiController : WebApiControllerBase
    {
        private UserIBLL userIBLL = new UserBLL();

        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId">用户主键</param>
        /// <returns></returns>
        [HttpGet]
        [ResponseType(typeof(UserEntity))]
        public IHttpActionResult GetUserEntity(string userId)
        {
            try
            {
                var data = userIBLL.GetEntityByUserId(userId);
                return Success(data);
            }
            catch (Exception ex)
            {
                return Fail(ex.Message);
            }
        }
    }
}